<template>
  <div>
    <div class="submit-item" @click="showDetail">
      <span>{{title}}</span>
      <i class="fa fa-chevron-down" aria-hidden="true"></i>
    </div>
    <div v-if="detail" class="detail-content">
      <p>{{content}}</p>
      <span>截止日期：{{deadline}}</span>
    </div>
    <input type="file" /><button>确认上传</button>
  </div>
</template>

<script>
const responseData = {
  title: '上交工图作业',
  content: '工图习题册第2页，第3页',
  deadline: '2017-5-6'
}
export default {
  name: 'homeworkSubmit',
  data: function () {
    return {
      title: responseData.title,
      content: responseData.content,
      deadline: responseData.deadline,
      detail: false
    }
  },
  methods: {
    showDetail: function () {
      this.detail = !this.detail
    }
  }
}
</script>

<style scoped>
.submit-item {
    width: 100%;
    height: 1.5rem;
    background-color: white;
    margin-top: 0.2rem;
    border: 1px solid #bdbdbd;
    position: relative;
    text-align: left;
}
.submit-item span {
    line-height: 1.5rem;
    font-size: 0.47rem;
    margin-left: 0.5rem;
}
.submit-item i {
    position: absolute;
    right: 1rem;
    top: 0.5rem;
    font-size: 0.47rem;
}
.detail-content {
    background-color: white;
    width: 100%;
    font-size: 0.43rem;
    padding: 0.2rem 0.3rem 0.3rem 0.3rem;
    box-sizing: border-box;
    margin-top: 0.02rem;
    border-bottom: 1px solid #bdbdbd;
    text-align: left;
}
.detail-content p {
    margin: 0.2rem 0;
}
input[type="file"] {
    font-size: 0.47rem;
    width: 6rem;
}
button {
  width: 3rem;
  height: 1.2rem;
  border-radius: 0.2rem;
  border: none;
  margin-top: 0.2rem;
  color: white;
  background-color: #388e3c;
  font-size: 0.4rem;
}
</style>
